from google.appengine.ext import webapp

from templating import render_template
from routing import map

class SwingsetRequestHandler(webapp.RequestHandler):        
    def initialize(self, *args, **kwargs):
        webapp.RequestHandler.initialize(self, *args, **kwargs)
        self.url = self.request.environ['routes.url'] 
    
    def render_and_write(self, template_name, **kwargs):
        kwargs['url'] = self.request.environ['routes.url']

        self.response.out.write( 
            render_template( 
                template_name, 
                **kwargs ))
